package com.nms.dao.impl;

import java.util.Properties;

import com.nms.dao.SystemInfoDao;

public class SystemInfoDaoImpl implements SystemInfoDao {
	/**
	 * 系统属性
	 */
	private Properties props = System.getProperties(); 

	@Override
	public String getOsName() {
		return props.getProperty("os.name");
	}

	@Override
	public String getOsVersion() {
		return props.getProperty("os.version");
	}

	@Override
	public String getOsArch() {
		return props.getProperty("os.arch");
	}

	@Override
	public String getSunArch() {
		return props.getProperty("sun.arch.data.model");
	}

	@Override
	public String getUserName() {
		return props.getProperty("user.name");
	}

	@Override
	public String getUserDir() {
		return props.getProperty("user.dir");
	}

	@Override
	public String getTmpDir() {
		return props.getProperty("java.io.tmpdir");
	}

	@Override
	public String getRuntimeName() {
		return props.getProperty("java.runtime.name");
	}

	@Override
	public String getRuntimeVersion() {
		return props.getProperty("java.runtime.version");
	}

	@Override
	public String getVmName() {
		return props.getProperty("java.vm.name");
	}

	@Override
	public String getVmVersion() {
		return props.getProperty("java.vm.version");
	}

	@Override
	public Float getFreeMemoery() {
		Long freeMemory = Runtime.getRuntime().freeMemory();
		return (float) (((double) freeMemory) / 1024 / 1024);
	}

	@Override
	public Float getTotalMemory() {
		Long totalMemory = Runtime.getRuntime().totalMemory();
		return (float) (((double) totalMemory) / 1024 / 1024);
	}

}
